/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.google.common.collect.Lists;

/**
 *  方案产品步骤Entity
 * @author liujiang
 * @version 2013-08-19
 */
@Entity
@Table(name = "solution_face_product_mix")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class SolutionFaceProductMix extends BaseEntity {
	
	public static final int TYPE_DAY = 0;//日间
	public static final int TYPE_NIGHT = 1;//夜间
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private SolutionFaceProductStep solutionFaceProductStep; 		// 家居保养步骤编号
	private int needed; // 0 - 必须1 - 非必须
	private int day_or_night;	// 日间或夜间：0 - 日间1 - 夜间

	private List<SolutionFaceProductMixStoreType> storeTypeList = Lists.newArrayList();
	private List<SolutionFaceProductMixDetail>  detailList = Lists.newArrayList();
	
	public SolutionFaceProductMix() {
	}

	public SolutionFaceProductMix(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(cascade={CascadeType.REFRESH},fetch = FetchType.LAZY)
	@JoinColumn(name="SFS_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public SolutionFaceProductStep getSolutionFaceProductStep() {
		return solutionFaceProductStep;
	}

	public void setSolutionFaceProductStep(SolutionFaceProductStep solutionFaceProductStep) {
		this.solutionFaceProductStep = solutionFaceProductStep;
	}
	
	public int getDay_or_night() {
		return day_or_night;
	}

	public void setDay_or_night(int day_or_night) {
		this.day_or_night = day_or_night;
	}

	public int getNeeded() {
		return needed;
	}

	public void setNeeded(int needed) {
		this.needed = needed;
	}
	
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY,mappedBy="solutionFaceProductMix")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public List<SolutionFaceProductMixDetail> getDetailList() {
		return detailList;
	}

	public void setDetailList(List<SolutionFaceProductMixDetail> detailList) {
		this.detailList = detailList;
	}
	
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY,mappedBy="solutionFaceProductMix")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public List<SolutionFaceProductMixStoreType> getStoreTypeList() {
		return storeTypeList;
	}

	public void setStoreTypeList(List<SolutionFaceProductMixStoreType> storeTypeList) {
		this.storeTypeList = storeTypeList;
	}
}
